package fuzzylizard.teamdocs.web.wicket;

import fuzzylizard.teamdocs.domain.File;
import fuzzylizard.teamdocs.domain.User;
import wicket.protocol.http.WebApplication;
import wicket.protocol.http.WebSession;

/**
 * Subclass of WebSession for TeamdocsApplication to allow easy and typesafe
 * access to session properties.
 */
public final class TeamdocsSession extends WebSession {
    private static final long serialVersionUID = 7317737094874757057L;

    private User user;
    private File currentDirectory;
    
    /**
     * Constructor
     * 
     * @param application The application
     */
    public TeamdocsSession(final WebApplication application) {
        super(application);
    }
    
    public File getDirectory() {
        return currentDirectory;
    }
    
    public void setDirectory(File directory) {
        this.currentDirectory = directory;
    }
    
    public User getUser() {
        return user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    public boolean loggedIn() {
        return user != null;
    }
}
